﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Globalization;

namespace Project
{
    public class ShortStringRule: ValidationRule
    {
        public int MinLenght { get; set; }

        public ShortStringRule(int minLeng)
        {
            MinLenght = minLeng;
        }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            string str = (string)value;
            if (str.Length <= MinLenght)
                return new ValidationResult(false, "La logitud del campo no puede ser menor a "+MinLenght+" caracteres");
            return new ValidationResult(true, null);
        }
    }
}
